<?
//~ include 'php/facebook.api.php';
//~ $_FB = new Facebook($_FACEBOOK);
//~ $url=$_FB->getLoginUrl(array('req_perms' =>$_FACEBOOK['rights'], 'redirect_uri'=>"{$_MISC['app-url']}/auth/facebook"));
//~ $maxrightsurl=$_FB->getLoginUrl(array('req_perms' =>$_FACEBOOK['maxrights'], 'redirect_uri'=>"{$_MISC['app-url']}/auth/facebook"));
?>

<div class="box_auth_connect">
<script>
this.title.set('html',"In order to listen you have to connect!");
cbox.addEvent("close",(function(){ setbodyclick();this.destroy()}).bind(this));
cbox.hideButton("Close").getParent().destroy();
cbox.addButton("Close",function(e){e.stop();this.close();})
</script>
	<input type="checkbox" class="checkbox" value="1" checked="checked" />(optional) tell my friends!</input>
	<br><br>
	<image class="connect" src="images/fb_connect.jpg" alt="Connect with Facebook">
</div>
<div>
<br/><br/><br/>
</div>

<div class="box_auth_mail_header"><h2>▶ Click here if you don't have a facebook account.</h2></div>
<div class="box_auth_mail_slider">
	You can easily register via e-mail:<br><br>
	<form action="http://fbapp.rene-pickhardt.de/auth/email/submit/email?mode=js" method="post" class="box_auth_form">
	<div><input type='text' id='email' name='email' value='Enter email address to register!' onclick='this.focus();this.select();' class='required validate-email'></input></div>
	<button type='submit' value='submit'>Go!</button></form>
</div>
<div class="spacer-10"></div>
<div class="spacer-10"></div>
<div class="spacer-10"></div>
<!--<h1>Check out this video for song snippets:</h1><br>
<iframe title="YouTube video player" width="460" height="288" src="http://www.youtube.com/embed/xWe_TO8wMfM" frameborder="0" allowfullscreen></iframe>
-->
<h1>Still not sure why you should connect?</h1><br>
Check out a <a href="http://www.youtube.com/watch?v=xWe_TO8wMfM" target="_blank">Video Medley</a> of the entire album first.
<script>
base_url="<?="{$_MISC['app-url']}/auth/facebook"?>";
additional_url="?additional_rights=publish_stream";
//script for the box
this.messageBox.setStyle("overflow","hidden");

this.messageBox.getElement('.box_auth_connect .connect').addEvent('click',(function(){
	final_url=base_url+(this.messageBox.getElement('.box_auth_connect .checkbox').get('checked')?additional_url:'');
	//top.location.href=base_url+(this.messageBox.getElement('.box_auth_connect .checkbox').get('checked')?additional_url:'');
	//~ fenster=window.open(final_url,'Listen to Ballads N Bullets','width=600,height=450');
	fenster=new Browser.Popup(final_url, {width:850, height:650,x:'center',y:'center',scrollbars:'no',resizable:0,name:'bullets'});
	fenster.focus();
	//~ var onclose=function(){if(console)console.info("closed");if (fenster.window.closed){ if(console)console.info("closedd");window.location.href='<?=$_MISC['app-url'].'?'.rand()?>';}else {fenster.window.onunload=onclose;}};
	//~ fenster.window.onunload=onclose;
	var watchwindow=function() {
		if (fenster.window.closed){ 
			window.location.href='<?=$_MISC['app-url'].'?'.rand()?>';
		} else {
			window.setTimeout(watchwindow,50);
		}
	};
	window.setTimeout(watchwindow,50);
	
}).bind(this));

new Form.Validator.Inline(this.messageBox.getElement('.box_auth_form'),{stopOnFailure: true,scrollToErrorsOnSubmit:false});
this.messageBox.getElement('.box_auth_mail_slider').slide('hide');
this.messageBox.getElement('.box_auth_mail_header').addEvent('click',(function(){this.messageBox.getElement('.box_auth_mail_slider').slide('toggle');this._resize();}).bind(this));
</script>